package com.wang.jmonkey.ca.model;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @Description 验证码信息
 * @Author HeJiawang
 * @Date 2021/5/11 9:42
 */
@Data
@Accessors(chain = true)
public class ValidateCode {

    /**
     * 验证码存储的key
     */
    private String deviceId;

    /**
     * 验证码内容
     */
    private String content;

    /**
     * 验证码值
     */
    private String code;

    public ValidateCode() {
    }

    public ValidateCode(String deviceId, String content) {
        this.deviceId = deviceId;
        this.content = content;
    }

    /**
     * 只返回验证码key与验证码内容，清空其他值信息
     * @return
     */
    public ValidateCode refresh() {
        return new ValidateCode(this.deviceId, this.content);
    }
}
